import {
  Module,
  NestModule,
  MiddlewareConsumer,
  // RequestMethod,
} from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';
import { Logger } from '../middleware/index';
@Module({
  controllers: [UserController],
  providers: [UserService],
  exports: [UserService], //共享模块，抛出服务
})
export class UserModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(Logger).forRoutes('user'); // 为user路由添加中间件
  }
}
//还可以直接把控制器塞进去 UserController consumer.apply(Logger).forRoutes(UserController);

/**
 * export declare enum RequestMethod {
    GET = 0,
    POST = 1,
    PUT = 2,
    DELETE = 3,
    PATCH = 4,
    ALL = 5,
    OPTIONS = 6,
    HEAD = 7,
    SEARCH = 8,
    PROPFIND = 9,
    PROPPATCH = 10,
    MKCOL = 11,
    COPY = 12,
    MOVE = 13,
    LOCK = 14,
    UNLOCK = 15
}

 */
